import { Controller, Get, Logger } from '@nestjs/common';
import { AppService } from './app.service';
import { Scraper } from './scrapers/scraper';

@Controller()
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Get()
  getHello(): string {
    return this.appService.getHello();
  }
  @Get('puppeteer/test')
  async testPupp() {
    const scraper = new Scraper({
      url: 'https://bot.sannysoft.com/',
      keyword: '',
    });
    const page = await scraper.launchBrowser();
    const body = await page.$eval('body', (el) => el.textContent);
    Logger.log(body);
    return body;
  }
}
